#include <LengthUnit.h>

const unsigned int MileVsYard    = 1760;
const unsigned int YardVsFeet    = 3;
const unsigned int BASE_UNIT_VALUE = 1;

LengthUnit::LengthUnit(const unsigned int factor):factor(factor)
{
}

const LengthUnit& LengthUnit::getMile( )
{
	static LengthUnit mile(MileVsYard*YardVsFeet*BASE_UNIT_VALUE);
	return mile;
}

const LengthUnit& LengthUnit::getYard( )
{
	static LengthUnit yard(YardVsFeet*BASE_UNIT_VALUE);
	return yard;
}

const LengthUnit& LengthUnit::getFeet( )
{
	static LengthUnit feet(BASE_UNIT_VALUE);
	return feet;
}

unsigned int LengthUnit::toAmountInBaseUnit( ) const
{
	return factor;
}
